package com.jd.dlc.limit.dynamic;

import com.jd.dlc.domain.DLCLimitRule;
import com.jd.dlc.domain.WrapLimiterRule;
import com.jd.neptune.painter.annotations.UMP;

/**
 * @program: dlc
 * @ClassName BLimiterRuleDynamic
 * @description:
 * @author: sizegang
 * @create: 2022-05-11
 **/
public abstract class BLimiterRuleDynamic implements Dynamic {
    /**
     * Update configuration rules
     *
     * @param dlcLimitRule
     * @return
     */
    @UMP
    public boolean refresh(DLCLimitRule dlcLimitRule) {
        return doRefresh(dlcLimitRule);
    }

    /**
     * Get configuration rules
     *
     * @param namespace
     * @param limitKey
     * @return
     */
    public WrapLimiterRule loadConfig(String namespace, String limitKey) {
        return doLoad(namespace, limitKey);
    }

    abstract WrapLimiterRule doLoad(String namespace, String limitKey);

    abstract boolean doRefresh(DLCLimitRule dlcLimitRule);
}
